package de.tu_darmstadt.gdi.battleship.tests;


//import org.junit.Before;
import static org.junit.Assert.*;
import static org.junit.Assert.fail;
import junit.framework.TestCase;

import org.junit.Test;

import de.tu_darmstadt.gdi.battleship.InvalidMapException;
import de.tu_darmstadt.gdi.battleship.Map;
import de.tu_darmstadt.gdi.battleship.CheckLevelStatus;

public class TestCheckLevelStatus extends TestCase{
	CheckLevelStatus check;
	public TestCheckLevelStatus(){
		this.check = new CheckLevelStatus();
	}
	public void testCompleteLevel(){
		Map map = null;
		try {
			map = new Map("src/de/tu_darmstadt/gdi/battleship/tests/testlevel.lvl");
		} catch (InvalidMapException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			fail("unerwartete Exception wurde geworfen!");
		}
		char[][] tempMap=map.returnWholeMap();
		assertFalse(check.levelComplete(tempMap));
	}
	public void testWhoWon(){
		Map map = null;
		try {
			map = new Map("src/de/tu_darmstadt/gdi/battleship/tests/testlevel.lvl");
		} catch (InvalidMapException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			fail("unerwartete Exception wurde geworfen!");
		}
		char[][] tempMap=map.returnWholeMap();
		assertTrue("Right Player Won the Game"==check.whoWon(tempMap)||"Failure, No Winner!"==check.whoWon(tempMap)||"Left Player Won the Game"==check.whoWon(tempMap));
	}
	
/*
	@Before
	public void setUp() throws Exception {
	}
	*/
/*	@Test
	public void testSetUp(){
		String path = "src/de/tu_darmstadt/gdi/battleship/tests/testlevel.lvl";
		try {
			Map map = new Map(path);
			char[][] tempMap=map.returnWholeMap();
			assertTrue(false == check.levelComplete(tempMap));
			//CheckLevelStatus.this.whoWon(map);
			//System.out.print(true);
		} catch (Exception e) {
			e.printStackTrace();
			fail("unerwartete Exception wurde geworfen!");
		}
		
	}*/
}
/*
import static org.junit.Assert.fail;

import java.util.Vector;

import org.junit.Test;

import de.tu_darmstadt.gdi.battleship.Battleground;
import de.tu_darmstadt.gdi.battleship.InvalidMapException;
import de.tu_darmstadt.gdi.battleship.Map;
import de.tu_darmstadt.gdi.battleship.Ship;
import de.tu_darmstadt.gdi.battleship.Speedboat;

*/
	
